# $Id: PKGBUILD 70332 2012-05-04 17:22:35Z spupykin $
# Maintainer: Sergej Pupykin <pupykin.s+arch@gmail.com>

pkgname=web-news
pkgver=1.6.4
pkgrel=4
pkgdesc="A PHP web-based NNTP client"
arch=('any')
url="http://sourceforge.net/projects/web-news"
license=('GPL')
depends=('php')
backup=('etc/webapps/web-news/.htaccess'
	'etc/webapps/web-news/webnews.cfg.php')
source=(http://downloads.sourceforge.net/sourceforge/web-news/WebNews-$pkgver.tar.gz
	utf8.patch)
md5sums=('712ec4812bed52569ab83596dd2291a9'
         '721064173f5b085c204b97c8bbe096e2')

build() {
  _instdir=$pkgdir/usr/share/webapps/web-news
  mkdir -p ${_instdir} $pkgdir/etc/webapps/web-news
  (cd $srcdir && patch -p1 <utf8.patch && rm -f utf8.patch)
  cd ${_instdir}
  rm -f $srcdir/WebNews-$pkgver.tar.gz
  cp -ra $srcdir/* .

  echo -e "deny from all\nAddDefaultCharset utf-8" >$pkgdir/etc/webapps/web-news/.htaccess
  ln -s /etc/webapps/web-news/.htaccess .htaccess

  mv config/webnews.cfg.php $pkgdir/etc/webapps/web-news/
  ln -s /etc/webapps/web-news/webnews.cfg.php config/webnews.cfg.php
}
